home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 32
/
Mac Magazin and MacEasy Magazine CD - Issue 32.iso
/
Multimedia
/
MIDI
/
MidiChaos_15 Folder
/
MidiChaos_1.5
/
Source
/
Screen
< prev
next >
Wrap
Text File
|
1992-04-24
|
10KB
|
388 lines
\ Control screen for MIDIChaos
\ Author: Darren Gibbs Copyright 1990
\ Date: 4/26/90
\
\ MOD: RDG 6/20/90 Restructured for polyphony.
\ MOD: RDG 9/20/90 Major restructuring; added support for new equations.
\ MOD: RDG 10/5/90 Restructured once again to support voice objects.
ANEW TASK-MC_SCREEN
VARIABLE CURRENT-VOICE
VARIABLE CURRENT-PARAM
: GET.GENERATOR ( -- addr , get current generator for current voice )
current-param @ current-voice @ generator@: []
;
\ Build faders.
OB.FADER P1-FADER
OB.FADER P2-FADER
OB.FADER X-FADER
OB.FADER LOW-FADER
OB.FADER HI-FADER
\ Fader functions to update parameters for each record.
: P1.FUNC ( value part -- , set p1 parameter for current voice )
drop
get.generator put.p1: []
;
: P2.FUNC ( value part -- , set p2 parameter for current voice )
drop
get.generator put.p2: []
;
: X.FUNC ( value part -- , set x parameter for current voice )
drop
get.generator put.x: []
;
: LOW.FUNC ( value part -- , set lowest allowable output value )
drop
dup
get.generator put.min: []
1+ 0 put.min: hi-fader
;
: HI.FUNC ( value part -- , set highest allowable output value )
drop
dup
get.generator put.max: []
1- 0 put.max: low-fader
;
: SET.FADER.FUNCTIONS ( -- , put function addresses into faders )
'c p1.func dup
put.down.function: p1-fader put.move.function: p1-fader
'c p2.func dup
put.down.function: p2-fader put.move.function: p2-fader
'c x.func dup
put.down.function: x-fader put.move.function: x-fader
'c low.func dup
put.down.function: low-fader put.move.function: low-fader
'c hi.func dup
put.down.function: hi-fader put.move.function: hi-fader
;
: BUILD.FADER ( w h incr knob_size fader -- )
dup>r put.knob.size: []
r@ put.increment: []
r@ put.wh: []
true r> if.show.value: []
;
: P1-FADER-DATA ( -- w h incr knob_size )
180 3000 1 100 p1-fader ;
: P2-FADER-DATA ( -- w h incr knob_size )
180 3000 1 100 p2-fader ;
: X-FADER-DATA ( -- w h incr knob_size )
180 2000 1 100 x-fader ;
: LOW-FADER-DATA ( -- w h incr knob_size )
180 1000 1 100 low-fader ;
: HI-FADER-DATA ( -- w h incr knob_size )
180 1000 1 100 hi-fader ;
: BUILD.FADERS ( -- )
p1-fader-data build.fader
" P1 " put.title: p1-fader
p2-fader-data build.fader
" P2 " put.title: p2-fader
x-fader-data build.fader
" X " put.title: x-fader
1 0 put.min: x-fader 99 0 put.max: x-fader
low-fader-data build.fader
0 0 put.min: low-fader 127 0 put.max: low-fader
hi-fader-data build.fader
1 0 put.min: hi-fader 127 0 put.max: hi-fader
set.fader.functions
;
\ -------------------------------------------------------------------------------
\ Words for the managing of a voice's faders.
\ -------------------------------------------------------------------------------
: SET.FADER.LIMITS ( -- )
get.function.min/max
?dup IF
-1 0 put.enable: p2-fader
0 put.max: p2-fader 0 put.min: p2-fader
ELSE
0 0 put.enable: p2-fader
THEN
0 put.max: p1-fader 0 put.min: p1-fader
;
: UPDATE.PARAMETER.FADERS ( -- )
get.generator dup get.function: []
set.fader.limits
dup \ generator
get.p1: [] 0 put.value: p1-fader
get.p2: [] 0 put.value: p2-fader
;
\ Words for updating scaling faders.
$ROM SCALING-TITLES
," Lowest Note " ," Highest Note "
," Min Velocity " ," Max Velocity "
," Min Duration " ," Max Duration "
: NOTE-SCALING-TITLES ( -- str1 str2 )
0 scaling-titles 1 scaling-titles ;
: VEL-SCALING-TITLES ( -- str1 str2 )
2 scaling-titles 3 scaling-titles ;
: DUR-SCALING-TITLES ( -- str1 str2 )
4 scaling-titles 5 scaling-titles ;
: UPDATE.SCALING.FADER.TITLES ( -- )
current-param @
CASE
note OF note-scaling-titles ENDOF
velocity OF vel-scaling-titles ENDOF
duration OF dur-scaling-titles ENDOF
ENDCASE
put.title: hi-fader
put.title: low-fader
;
: UPDATE.SCALING.FADER.VALUES { | low hi -- }
get.generator dup
get.min: [] -> low
get.max: [] -> hi
low 1+ 0 put.min: hi-fader
hi 1- 0 put.max: low-fader
low 0 put.value: low-fader
hi 0 put.value: hi-fader
;
: UPDATE.SCALING.FADERS ( -- )
update.scaling.fader.titles
update.scaling.fader.values
;
: UPDATE.FADERS ( -- )
update.parameter.faders
update.scaling.faders
;
\ -------------------------------------------------------------------------------
\ Setup a grid for changing the equation assigned to a midi parameter.
\ -------------------------------------------------------------------------------
: FUNC.GRID.FUNC ( value part -- , select a function for Midi parameter )
nip
get.generator use.function: [] \ uses part# as index to function
update.faders
;
OB.RADIO.GRID FUNC-GRID
: BUILD.FUNC-GRID ( -- )
600 300 put.wh: func-grid
" Function: " put.title: func-grid
1 get.#functions new: func-grid
'c function-names put.text.function: func-grid
'c func.grid.func put.down.function: func-grid
;
: UPDATE.FUNC-GRID ( -- , reset control to reflect desired equation )
get.generator get.function: [] 1 swap put.value: func-grid
;
: INIT.FUNC-GRID ( -- )
note current-param !
;
\ -------------------------------------------------------------------------------
\ Setup a grid to change the params currently assigned to the controls.
\ -------------------------------------------------------------------------------
: PARAM.GRID.FUNC ( value part -- , change control functions )
nip \ don't need value
current-param ! \ use part# as index to current parameter
update.func-grid
update.faders
;
OB.RADIO.GRID PARAM-GRID
: BUILD.PARAM-GRID ( -- )
600 300 put.wh: param-grid
" MIDI: " put.title: param-grid
1 get.#params new: param-grid
'c parameter-names put.text.function: param-grid
'c param.grid.func put.down.function: param-grid
;
\ -------------------------------------------------------------------------------
\ Set up a grid to turn voices on and off
\ -------------------------------------------------------------------------------
OB.RADIO.GRID ON/OFF-GRID
TEXTROM ON/OFF-TEXT ," OFF" ," ON "
: ON/OFF.GRID.FUNC ( value part -- , select on/off status of a Voice )
nip
CASE
0 OF current-voice @ stop: [] ENDOF
1 OF current-voice @ start: [] ENDOF
ENDCASE
;
: BUILD.ON/OFF-GRID ( -- )
300 300 put.wh: on/off-grid
1 2 new: on/off-grid
'c on/off-text put.text.function: on/off-grid
'c on/off.grid.func put.down.function: on/off-grid
;
: UPDATE.ON/OFF-GRID ( -- )
current-voice @ ?executing: []
IF 1 1
ELSE 1 0
THEN put.value: on/off-grid
;
\ -------------------------------------------------------------------------------
\ Grid to set midi channel for each voice
\ -------------------------------------------------------------------------------
: CHAN-GRID.FUNC ( value part -- )
drop \ don't need part
current-voice @ put.channel: []
;
OB.NUMERIC.GRID CHAN-GRID
: BUILD.CHAN-GRID ( -- )
300 300 put.wh: chan-grid
1 1 new: chan-grid
1 0 put.min: chan-grid
16 0 put.max: chan-grid
1 put.increment: chan-grid
" Chan. #" put.title: chan-grid
'c chan-grid.func put.up.function: chan-grid
;
: UPDATE.CHAN-GRID ( -- )
current-voice @ get.channel: []
0 put.value: chan-grid
;
\ -------------------------------------------------------------------------------
\ Words to switch voices.
\ -------------------------------------------------------------------------------
: UPDATE.CONTROLS ( -- )
update.on/off-grid
update.chan-grid
update.func-grid
update.faders
;
: VOICE-GRID.FUNC ( value part -- )
nip \ don't need value
at: voice-list current-voice !
update.controls
;
OB.RADIO.GRID VOICE-GRID
: BUILD.VOICE-GRID ( -- )
600 300 put.wh: voice-grid
" Voice:" put.title: voice-grid
1 many: voice-list new: voice-grid
'c voice-names put.text.function: voice-grid
'c voice-grid.func put.down.function: voice-grid
;
: INIT.VOICE-GRID ( -- )
0 at: voice-list current-voice !
1 0 put.value: voice-grid
;
: INIT.CONTROLS ( -- )
init.voice-grid
init.func-grid
;
\ -------------------------------------------------------------------------------
\ Set up a grid to start and stop recording.
\ -------------------------------------------------------------------------------
OB.RADIO.GRID RECORD-GRID
TEXTROM RECORD-TEXT ," Stop " ," Start "
: START.RECORDING ( -- )
" " 100 100 " " sfputfile
IF $midifile{
ELSE 1 0 put.value: record-grid \ turn control off if canceled
THEN
;
: STOP.RECORDING ( -- )
}midifile
;
: RECORD.GRID.FUNC ( value part -- , start and stop recording )
nip
pause.voices
CASE
0 OF stop.recording ENDOF
1 OF start.recording ENDOF
ENDCASE
unpause.voices
;
: BUILD.RECORD-GRID ( -- )
400 300 put.wh: record-grid
1 2 new: record-grid
1 0 put.value: record-grid
'c record-text put.text.function: record-grid
" Midi Record" put.title: record-grid
'c record.grid.func put.down.function: record-grid
;
\ -------------------------------------------------------------------------------
\ Declare and initalize the control screen
\ -------------------------------------------------------------------------------
OB.SCREEN MC-SCREEN
: BUILD.SCREEN ( -- )
" MidiChaos" put.title: mc-screen
0 scg.selnt
build.faders \ 5 faders
build.param-grid
build.func-grid
build.chan-grid
build.on/off-grid
build.voice-grid
build.record-grid
11 3 new: MC-SCREEN
P1-FADER 2500 500 add: MC-SCREEN
P2-FADER 2800 500 add: MC-SCREEN
X-FADER 2150 900 add: MC-SCREEN
HI-FADER 3200 700 add: MC-SCREEN
LOW-FADER 3200 2200 add: MC-SCREEN
PARAM-GRID 150 2250 add: MC-SCREEN
FUNC-GRID 1100 2250 add: MC-SCREEN
CHAN-GRID 800 1629 add: MC-SCREEN
ON/OFF-GRID 800 764 add: MC-SCREEN
VOICE-GRID 150 750 add: MC-SCREEN
RECORD-GRID 1320 1030 add: MC-SCREEN
;
: INIT.MAIN.SCREEN ( -- )
build.screen
init.controls
'c update.controls put.draw.function: mc-screen
;
: TERM.MAIN.SCREEN ( -- )
freeall: mc-screen
free: mc-screen
;